import {createRouter,createWebHashHistory} from "vue-router"

const routes=[
    {
        path:"/login",
        name:"login",
        component:()=>import("../views/login/index.vue")
    },
            {
                path:"/search",//默认子路由
                name:"search",
                component:()=>import("../views/search/index.vue")
            },
            {
                path:"/article/:articleId",//默认子路由
                name:"article",
                component:()=>import("../views/article/index.vue"),
                props:true
            },
    {
        path:"/",
        name:"layout",
        component:()=>import("../views/layout/index.vue"),
        children:[
            {
                path:"",//默认子路由
                name:"home",
                component:()=>import("../views/home/index.vue")
            },
            {
                path:"my",//默认子路由
                name:"my",
                component:()=>import("../views/my/index.vue")
            }
        ]
    }
]

//创建路由实例
const router =createRouter({
    history:createWebHashHistory(), //hash路由
    routes
})



export default router